package com.qishi.exampleOne;

/**
 * 记录性能监控信息
 */
public class MethodPerformance {

    private long begin;

    private long end;

    private String serviceMethod;

    public MethodPerformance(String serviceMethod) {

        this.serviceMethod = serviceMethod;

        //目标类方法开始的执行的系统时间
        begin = System.currentTimeMillis();
    }


    public void printPerformance() {
        end = System.currentTimeMillis();
        long elapse = end - begin;

        //报告目标类方法的执行时间
        System.out.println(serviceMethod+"花费"+elapse+"ms");
    }
}
